package com.zpf.pojo;

//前端页码goodList.jsp

import java.util.List;

public class PageBean {

    //当前页码pageNum--从前端获取
    private int pageNum;
    //每页条数pageSize -- 后端可以设置默认值（从前端获取）
    private int pageSize;
    //总条数totalCount--数据库查询
    private long totalCount;
    //总页数totalPage -- 算
    private int totalPage;
    //要展示的数据data --数据库查询
    private List data;
    //起始页startPage
    private int startPage = 1;
    //最后一页的页码endPage
    private int endPage;

    public int getPageNum() {
        return pageNum;
    }

    public void setPageNum(int pageNum) {
        this.pageNum = pageNum;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public long getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(long totalCount){
        this.totalCount = totalCount;
    }

    public int getTotalPage() {
        //总页数
        this.totalPage = (int)Math.ceil(totalCount * 1.0 / pageSize);
        return totalPage;
    }

    public void setTotalPage(int totalPage) {
        this.totalPage = totalPage;
    }

    public List getData() {
        return data;
    }

    public void setData(List data) {
        this.data = data;
    }

    public int getStartPage() {
        return startPage;
    }

    public void setStartPage(int startPage) {
        this.startPage = startPage;
    }

    public int getEndPage() {
        this.endPage = (int)Math.ceil(totalCount * 1.0 / pageSize);
        return endPage;
    }

    public void setEndPage(int endPage) {
        this.endPage = endPage;
    }
}
